public class Select_Test_for_Questions {

public List<Test__c> testList{get;set;}
public String test{get; set;}
public String testName{get; set;}
    
    public Select_Test_for_Questions() {
    testList = [Select Id, Name FROM Test__c];
    }
    
    public PageReference selectTest() {
    for (Test__c tests: testList){
        if (tests.Id==test){
        testName = tests.Name;
        }
    }
    
    if (test=='--None--'){
    return Page.TestQuestions;
    }else{
    return Page.TestQuestions2;
    }
    }

public List<SelectOption> gettestnames()
{

  List<SelectOption> options = new List<SelectOption>();
  options.add(new SelectOption('--None--','--None--'));
  if (testList.size()>0){
      for (Integer j=0;j<testList.size();j++)
      {
          options.add(new SelectOption(testList[j].Id,testList[j].Name));
      }
  
    }
  return options; 
  }
  
}